<?php
    App::import('Model', 'Picture');


    class PictureTestCase extends CakeTestCase {
        var $fixtures = array('app.picture', 'app.event', 'app.family',
                              'app.events_family', 'app.person', 'families_person');
    
    	function testUserOwnsPicture() {
    		$this->Picture =& ClassRegistry::init('Picture');
    		
    		$result = $this->Picture->userOwnsPicture(1, 1);
    		$this->assertTrue($result);
    	}
    
        function testGetThumbsEID() {
            $this->Picture =& ClassRegistry::init('Picture');
            
            $result = $this->Picture->getThumbsByEID(1);
            $expected = array(
                array('file_name' => 'testpic1', 'file_type' => 'jpg')
            );
            $this->assertEqual(true, true);
            
            $result = $this->Picture->getThumbsByEID(3);
            $expected = array();
            $this->assertEqual($result, $expected);            
        }
        
        function testGetThumbsFamily() {
            $this->Picture =& ClassRegistry::init('Picture');
            
            $result = $this->Picture->getThumbsByFamily(1);
            $expected = array(
                1 => array(
                    array(
                        'file_name' => 'testpic1',
                        'file_type' => 'jpg'
                    )
                ),
                2 => array(
                    array(
                        'file_name' => 'testpic2',
                        'file_type' => 'jpg'                    
                    )
                )
            );         
            $this->assertEqual($result, $expected);
            
            $result = $this->Picture->getThumbsByFamily(2);
            $expected = array();         
            $this->assertEqual($result, $expected);
            
            $result = $this->Picture->getThumbsByFamily(3);
            $expected = array();        
            $this->assertEqual($result, $expected);                        
        }
    
    
        function testGetPicturesFromEvent() {
            $this->Picture =& ClassRegistry::init('Picture');
            
            $result = $this->Picture->getPicturesFromEvent(1);
            $result = $result[0]['id'];
            $expected = 1;
            $this->assertEqual($expected, $result);          
        }
    }
 

?>
